#[cfg(test)]
mod tests {
    use crate::fast_thread_pool::{channel_types, TaskExecutor, init};
    use std::sync::Arc;
    use crossbeam::atomic::AtomicCell;

    #[test]
    fn test_channel_types() {
        // 测试 channel 创建和基本功能
        let (tx, rx) = channel_types::unbounded::<i32>();
        
        // 发送一些数据
        tx.send(42).unwrap();
        tx.send(100).unwrap();
        
        // 接收数据
        assert_eq!(rx.recv().unwrap(), 42);
        assert_eq!(rx.recv().unwrap(), 100);
        
        println!("Channel test passed!");
    }

    #[test]
    fn test_task_executor_unified() {
        unsafe { std::env::set_var("RUST_LOG", "debug") };
        env_logger::try_init().ok();

        init(false);
        let executor = TaskExecutor::new(
            core_affinity::CoreId { id: 0 }, 
            -1
        );
        
        let counter = Arc::new(AtomicCell::new(0_i32));
        let test_counter = counter.clone();
        
        // 提交一些测试任务
        for i in 0..10 {
            let counter = counter.clone();
            executor.spawn(move |core_id| {
                counter.fetch_add(1);
                println!("Task {} executed on core {}", i, core_id);
            });
        }
        
        // 等待任务完成
        std::thread::sleep(std::time::Duration::from_millis(100));
        
        assert_eq!(test_counter.load(), 10);
        println!("TaskExecutorUnified test passed!");
    }

    #[test]
    fn test_channel_feature_info() {
        #[cfg(feature = "crossbeam_channel")]
        println!("Using crossbeam::channel implementation");
        
        #[cfg(not(feature = "crossbeam_channel"))]
        println!("Using std::sync::mpsc implementation");
    }
} 